---
title: Creating your first plan
---

<ul class="main-content--version">
  <li>Current version:</li>
  <li><a class="active" href="/tutorials/getting-started/mac/create-plan">Mac</a></li>
  <li><a href="/tutorials/getting-started/linux/create-plan">Linux</a></li>
  <li><a href="/tutorials/getting-started/windows/create-plan">Windows</a></li>
</ul>
<hr />

# Create your first plan
<%= partial "/shared/create_plan_common", locals: { is_windows: false }%>

## Entering the studio and doing an initial build
The studio is a minimal, clean, [chrooted](https://en.wikipedia.org/wiki/Chroot) shell environment for you
to build and test your Habitat packages. The studio itself is a Habitat package, and all of the dependent packages for the studio will be downloaded,
unpacked, and installed. The studio will also import the secret origin key created during `hab setup`. When running Mac OS X on your host machine, the studio runs
inside a Docker container as root.

Packages are built in the studio through the `hab-plan-build` script, which handles creating Habitat packages from plan files.
The `hab-plan-build` script looks for `plan.sh` either in the current directory, or in a `./habitat` directory.

> Note: The current directory you are in on your host machine will become the `/src` directory when you enter the studio.
In this tutorial, because we are copying source files from within our repo into our package, we must enter the studio at the
`/mytutorialapp` directory level so that our `/source` directory is included in the chrooted studio environment.

1. Change directories to the root directory for your project.

       cd ~/habitat-example-plans/mytutorialapp/

2. Make sure Docker for Mac is running and then enter into the studio environment.

       hab studio enter

   The package download and installation process should only take a few moments. If successful, you should see another bash prompt like this:

       [1][default:/src:0]#

   Because the studio is chrooted, the `src` directory maps to the `~/habitat-example-plans/mytutorialapp` directory you were in before you entered the studio.

3. Run the `build` command to build your package.

       [2][default:/src:0]# build

    The last set of output messages from running `build` should look something like this:

      <%= partial "/shared/create_plan_build_output" %>

    The source files are stored in `/hab/pkgs/ORIGIN/PACKAGENAME/VERSION/RELEASE` (for example, `/hab/pkgs/myorigin/mytutorialapp/0.2.0/20160826191852`).  Listing the contents of that directory will show you the source files copied over in the **do_install()** callback as well as the nconf module files. By default, this location is ephemeral. When you exit the studio, the studio environment is destroyed and recreated the next time you enter it.

    The package created is stored in a relative `results` directory (for example, `/src/results/myorigin-mytutorialapp-0.2.0-20160826191852-x86_64-linux.hart`) that persists when you exit the studio.

Right now, your package builds, but will not do anything at runtime. The next step is to add hooks to your plan. These will link to the correct files during initialization and start the npm binary.

<hr>
<ul class="main-content--button-nav">
  <li><a href="/tutorials/getting-started/mac/add-hooks" class="button cta">Next - Add hooks to your plan</a></li>
  <li><a href="/tutorials/getting-started/mac/setup-environment/">Back to previous step</a></li>
</ul>
